<?php

require_once('../model/m_q_shifts_swaps.php');

class q_shifts_swaps {
	
	public $swapsData = array();
	//public $schedulesData = array();
	public $currentUser;
	
	public function actionView(){
		include_once("../views/v_session.php");
		include_once("../views/v_header_principal_q_shifts_swap_mgmt_ajax.html");
		include_once("../views/v_q_shifts_swap_management.html");
		include_once("../views/v_footer_principal.html");
	}


	public function actionViewSwaps($username){
		$this->swapsData = getSwaps($username); //Get list of swaps for user
		$this->currentUser = $username;
		include_once("../views/_v_q_shifts_swap_management.html");
	}	
	
	public function actionCancelSwap($swapId,$username){

		if(cancelSwap($swapId,$username)){
			$this->actionViewSwaps($username);
			exit;				
		} else {		
			echo "<h1> Error Denying Request</h1>";
			exit;
		}	
	}	
/*	
	public function actionViewDaySchedule($date){
		$this->currentDate = $date;
		$this->schedulesData = getDaySchedule($date); //Get schedules for a specific day
		include_once("../views/_v_shift_changes_schedules.html");
	}	

	public function actionApproveRequest($request_id){

		if(approvePendingRequest($request_id)){
			$this->actionViewPendingRequests();
			exit;				
		} else {		
			echo "<h1> Error Approving Request</h1>";
			exit;
		}	
	}	
		

	
	*/
		
}

$instancia= new q_shifts_swaps;

if(isset($_GET['view'])){
	if($_GET['view'] == "list")
		$instancia->actionView();
} else if(isset($_GET['viewSwaps'])){
		$instancia->actionViewSwaps($_GET['viewSwaps']);
} else if(isset($_GET['cancel'])){
		$instancia->actionCancelSwap($_GET['cancel'],$_GET['username']);
} /*else if(isset($_GET['approve'])){
		$instancia->actionApproveRequest($_GET['approve']);
}else if(isset($_GET['deny'])){
		$instancia->actionDenyRequest($_GET['deny']);
} else
	$instancia->actionView();

*/


?>